<?php 

use \Workerman\Worker;
use \Workerman\WebServer;
use \GatewayWorker\Gateway;
use \GatewayWorker\BusinessWorker;
use \Workerman\Autoloader;

require_once __DIR__ . '/../vendor/autoload.php';

$context = [
    'ssl' => [
        'local_cert'    => '/usr/local/nginx/conf/ssl/ling.cash/fullchain.cer', // 也可以是crt文件
        //'local_cert'    => '/usr/local/nginx/conf/ssl/dhparam.pem', // 也可以是crt文件
        'local_pk'      => '/usr/local/nginx/conf/ssl/ling.cash/ling.cash.key',
        'verify_peer'   => false,
        // 'allow_self_signed' => true, //如果是自签名证书需要开启此选项
    ]];

$gateway = new Gateway("websocket://0.0.0.0:8282",$context);
$gateway->transport = 'ssl';
$gateway->name = 'YourAppGateway';
$gateway->count = 1;
$gateway->lanIp = '127.0.0.1';
// 内部通讯起始端口，假如$gateway->count=4，起始端口为4000
// 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口 
$gateway->startPort = 2900;
// 服务注册地址
$gateway->registerAddress = '127.0.0.1:1238';
// 心跳间隔
$gateway->pingInterval = 15;
$gateway->pingNotResponseLimit = 2;
// 心跳数据
$gateway->pingData = '';
//$gateway->pingData = '{"type":"ping"}';

if(!defined('GLOBAL_START'))
{
    Worker::runAll();
}